package com.ada.demo.controller;

import com.ada.demo.service.IDemoService;
import com.ada.mvcframework.annotations.MyAutowired;
import com.ada.mvcframework.annotations.MyController;
import com.ada.mvcframework.annotations.MyRequestMapping;
import com.ada.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@MyController
@MyRequestMapping("/demo")
@Security(value = {"zhangsan","lisi"})
public class DemoController {
    @MyAutowired
    private IDemoService demoService;

    /**
     * /demo/query
     * @param request
     * @param response
     * @param name
     * @return
     */
    @MyRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response,String name){
        try {
            response.getWriter().write("success!");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * /demo/methodCheck
     * @param request
     * @param response
     * @param name
     * @return
     */
    @MyRequestMapping("/methodCheck")
    @Security(value = {"wanger"})
    public void methodCheck(HttpServletRequest request, HttpServletResponse response,String name){
        try {
            response.getWriter().write("success!");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
